package demo2;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main1(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.display();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.add(5);

        myArrayList.display();
        System.out.println(myArrayList.usedsize);
        System.out.println(myArrayList.elem.length);

    }

    public static void main2(String[] args)throws IndexOutOfException {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.display();
        myArrayList.add(1,99);
        System.out.println();
    }

    public static void main3(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        try{
            myArrayList.add(12,999);
        }catch(IndexOutOfException e) {
            e.printStackTrace();
        }

    }

    public static void main4(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        try{
            myArrayList.add(1,23);
        }catch(IndexOutOfException e) {
            e.printStackTrace();
        }
        try{
            myArrayList.deletePos(12);
        }catch(IndexOutOfException e){
            e.printStackTrace();
        }
    }

    public static void main5(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(12);
        myArrayList.add(23);
        myArrayList.add(223);
        myArrayList.set(2,23);
        System.out.println(myArrayList.usedsize);
        myArrayList.display();
        myArrayList.set(3,231);
        System.out.println(myArrayList.usedsize);
        myArrayList.display();

    }

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(12);
        list.set(0,12);

    }


}
